<?php include_once('header.php');?>
	<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li>
					<i class="icon-home home-icon"></i>
					会员管理
				</li>
				<li>
					会员级别列表
				</li>
			</ul>
		</div>
		<div class="page-content">
			<div class="page-header">
				<h1 class="blue"><i class="icon-edit"></i> 编辑会员级别信息</h1>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<form class="form-horizontal" enctype="multipart/form-data" role="form" method="post" action="/admin/user_level/add"  onsubmit="return check()">
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">名称:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="user_level_name" id="user_level_name" value="">
							</div>
						</div>													
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">名称显示颜色:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="color" id="color" value="green">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">团队业绩下限:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="username" name="group_performance" id="group_performance" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">其他市场业绩下限:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="other_performance" name="other_performance" value="">
							</div>
						</div>
                                            <div class="form-group">
							<label for="title" class="col-sm-1 control-label">与上级极差奖励:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="range" name="range" value="">上级是按照团队业绩划分，请填写0-1之前的两位小数（最低一级是互助收入）
							</div>
						</div>
                        <div class="form-group">
							<label for="title" class="col-sm-1 control-label">晋升奖励:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="reward" name="reward" value="">请填写0-1之前的两位小数
							</div>
						</div>
						<div class="form-group">
							<label for="title" class="col-sm-1 control-label">直推奖励:</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" id="zhitui" name="zhitui" value="">请填写0-1之前的两位小数
							</div>
						</div>
					 	<div class="form-group">
					   		<div class="col-sm-offset-1 col-sm-10">
								<button type="submit" id="submit" class="btn btn-primary">确定</button>
								<button type="submit" id="cancel" class="btn btn-primary">取消</button>
							</div>
					  	</div>
					</form>	
				</div>
			</div>					
		</div>													
	</div>
<?php include_once('content.php');?>
	<link href="/public_source/www/assets/css/ace.min.css" rel="stylesheet" />	
	<link href="/public_source/www/assets/css/jquery.tag-editor.css" rel="stylesheet"/>
    <script src="/public_source/www/assets/js/bootbox.min.js"></script>  
	<script src="/public_source/www/assets/js/jquery.tag-editor.min.js"></script>
	<script src="/public_source/www/js/areas.js"></script>
<?php include_once('footer.php');?>	
<script type="text/javascript">
	$(document).ready(function(){
		$("#cancel").click(function() {
			window.location.replace('/admin/user_level/index');
			return false;
		});
	});
	function check() {
	   var user_level_name = document.getElementById("user_level_name").value;
	   var group_performance = document.getElementById("group_performance").value;
	   var other_performance = document.getElementById("other_performance").value;
           var data = {group_performance:group_performance,other_performance:other_performance};
	   if(user_level_name ==  null || user_level_name == '') {
	        alert("名称不能为空");
	        return false;
	   }
	   if(group_performance ==  null || group_performance == '') {
	        alert("团队下限不能为空");
	        return false;
	   }

	   if(other_performance ==  null || other_performance == '') {
	        alert("其他市场下限不能为空");
	        return false;
	   }
           $.ajax({
			url:"/admin/user_level/check_sole",
			async: false,
			type:"post",
			data: data,
			dataType: 'json',
			success:function(data) {
				bool = data;
			}	
		});
		if(!bool) {
		   	$.alert({
			    title: '提示',
			    content:'该级别已存在',
			    confirm: function(){
			    }
			});
			 return false;	
		}
	   return true;
	}			
</script>		